{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'detail1' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-9-cf8582ab86a8>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      3\u001b[0m \u001b[0morder\u001b[0m\u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread_csv\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'meal_order_info.csv'\u001b[0m \u001b[1;33m,\u001b[0m\u001b[0msep\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m','\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mencoding\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'gb18030'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 4\u001b[1;33m \u001b[0mdetail1\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'order_id'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdetail1\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'order_id'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mint\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      5\u001b[0m \u001b[0morder\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'info_id'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0morder\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'info_id'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mastype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'str'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      6\u001b[0m \u001b[0morder\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNameError\u001b[0m: name 'detail1' is not defined"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "order= pd.read_csv('meal_order_info.csv' ,sep=',',encoding='gb18030')\n",
    "detail1['order_id']=detail1['order_id'].apply(int)\n",
    "order['info_id']=order['info_id'].astype('str')\n",
    "order"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'detail1' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-8-be3a5621adea>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0morder_detail\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmerge\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdetail1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0morder\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mleft_on\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'order_id'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mright_on\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'info_id'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m: name 'detail1' is not defined"
     ]
    }
   ],
   "source": [
    "order_detail=pd.merge(detail1.order,left_on='order_id',right_on='info_id')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0                      蒜蓉生蚝\n",
       "1         蒙古烤羊腿\\r\\n\\r\\n\\r\\n\n",
       "2                      大蒜苋菜\n",
       "3                     芝麻烤紫菜\n",
       "4                       蒜香包\n",
       "               ...         \n",
       "1154    红酒土豆烧鸭腿\\r\\n\\r\\n\\r\\n\n",
       "1169                   冰镇花螺\n",
       "1411                  冬瓜炒苦瓜\n",
       "1659                超人气广式肠粉\n",
       "2438             百里香奶油烤紅酒牛肉\n",
       "Name: dishes_name, Length: 154, dtype: object"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detail=pd.read_excel('meal_order_detail.xlsx')\n",
    "dishes_name=detail['dishes_name'].drop_duplicates()\n",
    "dishes_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>detail_id</th>\n",
       "      <th>order_id</th>\n",
       "      <th>dishes_id</th>\n",
       "      <th>logicprn_name</th>\n",
       "      <th>parent_class_name</th>\n",
       "      <th>dishes_name</th>\n",
       "      <th>itemis_add</th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "      <th>cost</th>\n",
       "      <th>place_order_time</th>\n",
       "      <th>discount_amt</th>\n",
       "      <th>discount_reason</th>\n",
       "      <th>kick_back</th>\n",
       "      <th>add_inprice</th>\n",
       "      <th>add_info</th>\n",
       "      <th>bar_code</th>\n",
       "      <th>picture_file</th>\n",
       "      <th>emp_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2956</td>\n",
       "      <td>417</td>\n",
       "      <td>610062</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜蓉生蚝</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>49</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:05:36</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/104001.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2958</td>\n",
       "      <td>417</td>\n",
       "      <td>609957</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒙古烤羊腿\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:07:07</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/202003.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2961</td>\n",
       "      <td>417</td>\n",
       "      <td>609950</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>大蒜苋菜</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:07:40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/303001.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2966</td>\n",
       "      <td>417</td>\n",
       "      <td>610038</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>芝麻烤紫菜</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:11:11</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/105002.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2968</td>\n",
       "      <td>417</td>\n",
       "      <td>610003</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜香包</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:11:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/503002.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "      <td>6750</td>\n",
       "      <td>774</td>\n",
       "      <td>610011</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>白饭/大碗</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 21:56:24</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/601005.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2775</th>\n",
       "      <td>6742</td>\n",
       "      <td>774</td>\n",
       "      <td>609996</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>牛尾汤</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 21:56:48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/201006.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2776</th>\n",
       "      <td>6756</td>\n",
       "      <td>774</td>\n",
       "      <td>609949</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>意文柠檬汁</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:01:52</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/404005.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2777</th>\n",
       "      <td>6763</td>\n",
       "      <td>774</td>\n",
       "      <td>610014</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>金玉良缘</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:03:58</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302003.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2778</th>\n",
       "      <td>6764</td>\n",
       "      <td>774</td>\n",
       "      <td>610017</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>酸辣藕丁</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>33</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:04:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302006.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2779 rows × 19 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      detail_id  order_id  dishes_id  logicprn_name  parent_class_name  \\\n",
       "0          2956       417     610062            NaN                NaN   \n",
       "1          2958       417     609957            NaN                NaN   \n",
       "2          2961       417     609950            NaN                NaN   \n",
       "3          2966       417     610038            NaN                NaN   \n",
       "4          2968       417     610003            NaN                NaN   \n",
       "...         ...       ...        ...            ...                ...   \n",
       "2774       6750       774     610011            NaN                NaN   \n",
       "2775       6742       774     609996            NaN                NaN   \n",
       "2776       6756       774     609949            NaN                NaN   \n",
       "2777       6763       774     610014            NaN                NaN   \n",
       "2778       6764       774     610017            NaN                NaN   \n",
       "\n",
       "            dishes_name  itemis_add  counts  amounts  cost  \\\n",
       "0                  蒜蓉生蚝           0       1       49   NaN   \n",
       "1     蒙古烤羊腿\\r\\n\\r\\n\\r\\n           0       1       48   NaN   \n",
       "2                  大蒜苋菜           0       1       30   NaN   \n",
       "3                 芝麻烤紫菜           0       1       25   NaN   \n",
       "4                   蒜香包           0       1       13   NaN   \n",
       "...                 ...         ...     ...      ...   ...   \n",
       "2774              白饭/大碗           0       1       10   NaN   \n",
       "2775                牛尾汤           0       1       40   NaN   \n",
       "2776             意文柠檬汁            0       1       13   NaN   \n",
       "2777               金玉良缘           0       1       30   NaN   \n",
       "2778               酸辣藕丁           0       1       33   NaN   \n",
       "\n",
       "        place_order_time  discount_amt  discount_reason  kick_back  \\\n",
       "0    2016-08-01 11:05:36           NaN              NaN        NaN   \n",
       "1    2016-08-01 11:07:07           NaN              NaN        NaN   \n",
       "2    2016-08-01 11:07:40           NaN              NaN        NaN   \n",
       "3    2016-08-01 11:11:11           NaN              NaN        NaN   \n",
       "4    2016-08-01 11:11:30           NaN              NaN        NaN   \n",
       "...                  ...           ...              ...        ...   \n",
       "2774 2016-08-10 21:56:24           NaN              NaN        NaN   \n",
       "2775 2016-08-10 21:56:48           NaN              NaN        NaN   \n",
       "2776 2016-08-10 22:01:52           NaN              NaN        NaN   \n",
       "2777 2016-08-10 22:03:58           NaN              NaN        NaN   \n",
       "2778 2016-08-10 22:04:30           NaN              NaN        NaN   \n",
       "\n",
       "      add_inprice  add_info  bar_code      picture_file  emp_id  \n",
       "0               0       NaN       NaN  caipu/104001.jpg    1442  \n",
       "1               0       NaN       NaN  caipu/202003.jpg    1442  \n",
       "2               0       NaN       NaN  caipu/303001.jpg    1442  \n",
       "3               0       NaN       NaN  caipu/105002.jpg    1442  \n",
       "4               0       NaN       NaN  caipu/503002.jpg    1442  \n",
       "...           ...       ...       ...               ...     ...  \n",
       "2774            0       NaN       NaN  caipu/601005.jpg    1138  \n",
       "2775            0       NaN       NaN  caipu/201006.jpg    1138  \n",
       "2776            0       NaN       NaN  caipu/404005.jpg    1138  \n",
       "2777            0       NaN       NaN  caipu/302003.jpg    1138  \n",
       "2778            0       NaN       NaN  caipu/302006.jpg    1138  \n",
       "\n",
       "[2779 rows x 19 columns]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detail"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>counts</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>-0.253092</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>amounts</th>\n",
       "      <td>-0.253092</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           counts   amounts\n",
       "counts   1.000000 -0.253092\n",
       "amounts -0.253092  1.000000"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "corrDet=detail[['counts','amounts']].corr(method='kendall')\n",
    "corrDet"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>counts</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>-0.174648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>amounts</th>\n",
       "      <td>-0.174648</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           counts   amounts\n",
       "counts   1.000000 -0.174648\n",
       "amounts -0.174648  1.000000"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "corrDet1=detail[['dishes_name','counts','amounts']].corr(method='pearson')\n",
    "corrDet1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "detail_id               0\n",
       "order_id                0\n",
       "dishes_id               0\n",
       "logicprn_name        2779\n",
       "parent_class_name    2779\n",
       "dishes_name             0\n",
       "itemis_add              0\n",
       "counts                  0\n",
       "amounts                 0\n",
       "cost                 2779\n",
       "place_order_time        0\n",
       "discount_amt         2779\n",
       "discount_reason      2779\n",
       "kick_back            2779\n",
       "add_inprice             0\n",
       "add_info             2779\n",
       "bar_code             2779\n",
       "picture_file            0\n",
       "emp_id                  0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detail.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "detail_id            2779\n",
       "order_id             2779\n",
       "dishes_id            2779\n",
       "logicprn_name           0\n",
       "parent_class_name       0\n",
       "dishes_name          2779\n",
       "itemis_add           2779\n",
       "counts               2779\n",
       "amounts              2779\n",
       "cost                    0\n",
       "place_order_time     2779\n",
       "discount_amt            0\n",
       "discount_reason         0\n",
       "kick_back               0\n",
       "add_inprice          2779\n",
       "add_info                0\n",
       "bar_code                0\n",
       "picture_file         2779\n",
       "emp_id               2779\n",
       "dtype: int64"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detail.notnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2779, 11)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detail.dropna(axis=1,how='any').shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2779, 19)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detail.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 76. 102.]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([13., 15.])"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from scipy.interpolate import interp1d\n",
    "x=np.array([1,2,3,4,5,8,9,10])\n",
    "y1=np.array([2,8,18,32,50,128,162,200])\n",
    "y2=np.array([3,5,7,9,11,17,19,21])\n",
    "l1=interp1d(x,y1,kind='linear')\n",
    "print(l1([6,7]))\n",
    "l2=interp1d(x,y2,kind='linear')\n",
    "l2([6,7])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[72. 98.]\n",
      "[13. 15.]\n"
     ]
    }
   ],
   "source": [
    "from scipy.interpolate import lagrange\n",
    "l1=lagrange(x,y1)\n",
    "print(l1([6,7]))\n",
    "l2=lagrange(x,y2)\n",
    "print(l2([6,7]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "poly1d([ 6.93889390e-18, -1.11022302e-16,  7.10542736e-15, -4.61852778e-14,\n",
       "        1.70530257e-13,  2.00000000e+00,  3.41060513e-13, -8.52651283e-14])"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import scipy\n",
    "scipy.interpolate.lagrange(x,y1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
